package com.book.common.utils;

import java.util.UUID;

import static com.book.common.utils.BookEveryId.*;
import static com.book.common.utils.BookMessage.*;

public class BookMethod {

    /**
     * @Description:书籍所在区块
     */
    public static Integer head(String booktype) {
        if ("数学".equals(booktype)) {
            return BOOK_TYPE_MATH;
        } else if ("英语".equals(booktype)) {
            return BOOK_TYPE_ENGLISH;
        } else if ("计算机".equals(booktype)) {
            return BOOK_TYPE_COMPUTER;
        } else if ("艺术".equals(booktype)) {
            return BOOK_TYPE_ART;
        } else if ("寓言童话".equals(booktype)) {
            return BOOK_TYPE_FABLE;
        } else if ("军事".equals(booktype)) {
            return BOOK_TYPE_MILITARY;
        } else if ("武侠".equals(booktype)) {
            return BOOK_TYPE_DRAGON;
        } else {
            return 0;//找不到该类型书籍
        }
    }

    /**
     * @Description:书籍介绍
     */
    public static String message(String booktype) {
        if ("数学".equals(booktype)) {
            return MATH_MESSAGE;
        } else if ("英语".equals(booktype)) {
            return ENGLISH_MESSAGE;
        } else if ("计算机".equals(booktype)) {
            return COMPUTER_MESSAGE;
        } else if ("艺术".equals(booktype)) {
            return ART_MESSAGE;
        } else if ("寓言童话".equals(booktype)) {
            return FABLE_MESSAGE;
        } else if ("军事".equals(booktype)) {
            return MILITARY_MESSAGE;
        } else if ("武侠".equals(booktype)) {
            return NOVEL_MESSAGE;
        } else {
            return "找不到该类型书籍介绍";
        }
    }

    /**
    * @Description: 定位数据
    * @Param:
    * @return:
    * @Author: Mr.Zhang
    * @Date: 2021/1/14
    */
    public static String getUUID() {
        UUID uuid = UUID.randomUUID();
        String str = uuid.toString();
        // 去掉"-"符号
        String temp = str.substring(0, 8) +str.substring(9, 13) + str.substring(14, 18) + str.substring(19, 23) +str.substring(24);
        return temp;
    }
}
